#include "newsample.h"
#include "ui_newsample.h"

NewSample::NewSample(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NewSample)
{
    ui->setupUi(this);
    showMaximized();

#ifdef Q_WS_MAEMO_5
    setAttribute(Qt::WA_Maemo5StackedWindow,true);
    setAttribute(Qt::WA_Maemo5AutoOrientation,true);
#endif
}

NewSample::~NewSample()
{
    delete ui;
}

void NewSample::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void NewSample::on_ok_clicked()
{
    done(QDialog::Accepted);
}

void NewSample::on_cancel_clicked()
{
    done(QDialog::Rejected);
}

const QDate NewSample::getDate() const
{
    return ui->date->date();
}

const QTime NewSample::getTime() const
{
    return ui->time->time();
}

unsigned int NewSample::getSystolic() const
{
    return ui->systolic->value();
}

unsigned int NewSample::getDiastolic() const
{
    return ui->diastolic->value();
}

unsigned int NewSample::getFrequency() const
{
    return ui->frequency->value();
}

const QString NewSample::getNote() const
{
    return ui->note->toPlainText();
}

void NewSample::setDate(const QDate &date)
{
    ui->date->setDate(date);
}

void NewSample::setTime(const QTime &time)
{
    ui->time->setTime(time);
}

void NewSample::setSystolic(unsigned int systolic)
{
    ui->systolic->setValue(systolic);
}

void NewSample::setDiastolic(unsigned int diastolic)
{
    ui->diastolic->setValue(diastolic);
}

void NewSample::setFrequency(unsigned int frequency)
{
    ui->frequency->setValue(frequency);
}

void NewSample::setNote(const QString &note)
{
    ui->note->setText(note);
}
